<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Http\Request;

class Users extends Model
{
	//定义当前模型关联的表名
	protected $table = 'users';

	public function checkUser(Request $request)
	{
		//根据账号获取用户信息
		$ob = $this->where("name",$request->input("name"))->first();

		if($ob){
			if($ob->password == md5($request->input("password"))){
				return $ob;
			}
		}

		return null;
	}
}